ci: update release candidate in pull request when changes are available#552
Conversation
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #552 +/- ##
==========================================
- Coverage 71.66% 71.65% -0.01%
==========================================
Files 226 226
Lines 19115 19115
==========================================
- Hits 13698 13697 -1
- Misses 4210 4212 +2
+ Partials 1207 1206 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
zimeg
left a comment
There was a problem hiding this comment.
A few comments 🦑 for the amazing reviewers!
| # Note the following _does not change releases or tags_ - it only creates release notes, just like clicking "Generate Release Notes" on the GitHub Releases page. | ||
| CHANGELOG=$(curl -L -X POST -H "Accept: application/vnd.github+json" -H "Authorization: Bearer $GITHUB_RELEASE_TOKEN" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/slackapi/slack-cli/releases/generate-notes -d "{\"tag_name\":\"${TARGET}\",\"target_commitish\":\"${TARGET}\",\"previous_tag_name\":\"${LAST_SEMVER_TAG}\"}" | jq .body) | ||
| echo "Will use release notes: ${CHANGELOG}" | ||
| BODY+="\"body\":$CHANGELOG}" |
There was a problem hiding this comment.
🧮 note: Some refactoring to make curl statements explicit instead of additive but no change to what's shown AFAICT!
| fi | ||
| echo "Creating GitHub release for $RELEASE_REF..." | ||
| RELEASE_ID=$(curl -X POST -H "Accept: application/vnd.github+json" -H "Authorization: token $GITHUB_RELEASE_TOKEN" https://api.github.com/repos/slackapi/slack-cli/releases -d "{\"tag_name\":\"${RELEASE_REF}\",\"name\":\"${RELEASE_REF}\",\"target_commitish\":\"${TARGET}\",\"draft\":false,\"prerelease\":${PRERELEASE},\"generate_release_notes\":true}" | jq -r .id) | ||
| elif [ "<< parameters.production >>" = "false" ]; then |
There was a problem hiding this comment.
📚 note: We might prefer the more simple "else" here but current changes hope that we generate release notes ourselves to skip this step. The release would be created before this point so we skip to "uploading assets" next
| -H "Content-Type: $(file -b --mime-type ${binary})" \ | ||
| -H "Content-Length: $(wc -c <${binary} | xargs)" \ | ||
| -T "${binary}" \ | ||
| "https://uploads.github.com/repos/slackapi/slack-cli/releases/$RELEASE_ID/assets?name=$(basename ${binary})" | cat |
There was a problem hiding this comment.
👁️🗨️ note: Formatting change for indentation.
| make tag RELEASE_VERSION="$RELEASE_VERSION" | ||
| git push origin "HEAD:refs/heads/rc" --force | ||
|
|
||
| - name: Create or update release PR |
There was a problem hiding this comment.
📣 note: We have an example of these outputs with #553!
| # @printf "$(FONT_BOLD)Git Tag$(FONT_RESET)\n" | ||
| # git tag v$(RELEASE_VERSION) |
There was a problem hiding this comment.
🪓 note: If we're confident on this direction I plan to update runbooks to create the tag separate.
| @printf "$(FONT_BOLD)Creating Branch$(FONT_RESET)\n" | ||
| git checkout -b "chore-release-$(RELEASE_VERSION)" | ||
| @printf "$(FONT_BOLD)Building CLI$(FONT_RESET)\n" | ||
| $(MAKE) build-ci LDFLAGS="-X 'github.com/slackapi/slack-cli/internal/version.Version=v$(RELEASE_VERSION)'" |
There was a problem hiding this comment.
👾 note: We now build as part of this step for confidence that we're generating the latest.
Changelog
Summary
This PR updates release candidates in pull requests when changes are available 🐙 ✨
Preview
This PR following uses this branch as a base IIRC:
🔗 #553
Notes
Requirements